Skip to content

feat(e2e): add Python governance scenarios and CI workflow#3345

Merged
MohammadHaroonAbuomar merged 9 commits into
mainfrom
feat/python-governance-e2e
Jul 21, 2026
Merged

feat(e2e): add Python governance scenarios and CI workflow#3345
MohammadHaroonAbuomar merged 9 commits into
mainfrom
feat/python-governance-e2e

Conversation

@prayagupa

Copy link
Copy Markdown
Collaborator

Description

Adds a Python end-to-end governance suite covering five production control boundaries:

  • Policy denial prevents an unauthorized live budget mutation.
  • Policy allowance permits a non-diagnostic record update.
  • PII redaction removes sensitive data before model and tool boundaries.
  • Prompt-injection detection blocks poisoned retrieval content before model invocation.
  • Filesystem sandboxing prevents writes outside the configured workspace.

Adds a GitHub Actions workflow that runs the suite against Ollama and llama3.1. The workflow pins the Ollama release, verifies its archive checksum and model digest, caches the model, and uploads scenario results, JUnit output, and runtime metadata.

Also updates the v4 ratchet inventory, secret-scanning fixture allowlist, spell-check terms, and E2E documentation.

See example: https://github.com/microsoft/agent-governance-toolkit/actions/runs/29459498584/job/87499812340

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Maintenance (dependency updates, CI/CD, refactoring)
  • Security fix

Package(s) Affected

  • agent-os-kernel
  • agent-mesh
  • agent-runtime
  • agent-sre
  • agent-governance
  • docs / root

Checklist

  • My code follows the project style guidelines (ruff check)
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass (pytest)
  • I have updated documentation as needed
  • I have signed the Microsoft CLA

Attribution & Prior Art

  • This contribution does not contain code copied or derived from other projects without attribution
  • Any external projects that inspired this design are credited in code comments or documentation
  • If this PR implements functionality similar to an existing open-source project, I have listed it below

Prior art / related projects (if any):

None.

AI Assistance

  • I can explain every meaningful change in this PR: what it does, why, and what tradeoffs were considered
  • I have run tests and verification appropriate for this change
  • No part of this PR was autonomously submitted by an AI agent without my review
  • I have not used AI to generate review comments on others' PRs

If AI tools materially shaped this change, briefly note what was used:

GitHub Copilot assisted with implementation, documentation, and validation. The contributor directed and reviewed the resulting changes.

IP, Patents, and Licensing

  • This contribution does not implement patent-pending or patent-encumbered techniques
  • This contribution does not require an NDA or licensing agreement to understand or use
  • Any AI tools used have terms compatible with the MIT License

Related Issues

None.

@prayagupa
prayagupa marked this pull request as ready for review July 15, 2026 23:52
@github-actions

Copy link
Copy Markdown

PR Review Summary

Check Status Details
🔍 Code Review ⚠️ Missing No current-run comment
🛡️ Security Scan ⚠️ Missing No current-run comment
🔄 Breaking Changes ⚠️ Missing No current-run comment
📝 Docs Sync ⚠️ Missing No current-run comment
🧪 Test Coverage ⚠️ Missing No current-run comment

Verdict: ⚠️ AI review incomplete; ready for human review

AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims.

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests scripts/ci/cd labels Jul 15, 2026
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/cache 55cc8345863c7cc4c66a329aec7e433d2d1c52a9 🟢 6.4
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Maintained🟢 1013 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Packaging⚠️ -1packaging workflow not detected
Binary-Artifacts🟢 10no binaries found in the repo
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies🟢 3dependency not pinned by hash detected -- score normalized to 3
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
SAST🟢 10SAST tool is run on all commits
Branch-Protection⚠️ 1branch protection is not maximal on development and all release branches
actions/actions/checkout df4cb1c069e1874edd31b4311f1884172cec0e10 🟢 6.9
Details
CheckScoreReason
Maintained🟢 1024 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Code-Review🟢 10all changesets reviewed
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Packaging⚠️ -1packaging workflow not detected
Pinned-Dependencies🟢 3dependency not pinned by hash detected -- score normalized to 3
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
SAST🟢 10SAST tool is run on all commits
Branch-Protection🟢 5branch protection is not maximal on development and all release branches
actions/actions/setup-python a309ff8b426b58ec0e2a45f0f869d46889d02405 🟢 6.6
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Maintained🟢 1017 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Pinned-Dependencies🟢 7dependency not pinned by hash detected -- score normalized to 7
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
SAST🟢 9SAST tool is not run on all commits -- score normalized to 9
actions/actions/upload-artifact 043fb46d1a93c77aae656e7c1c64a875d1fc6a0a 🟢 5.2
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Maintained⚠️ 00 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Binary-Artifacts🟢 10no binaries found in the repo
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies⚠️ 1dependency not pinned by hash detected -- score normalized to 1
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
SAST🟢 10SAST tool is run on all commits
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
actions/dtolnay/rust-toolchain 29eef336d9b2848a0b548edc03f92a220660cdb8 🟢 4.7
Details
CheckScoreReason
Code-Review⚠️ 0Found 0/20 approved changesets -- score normalized to 0
Packaging⚠️ -1packaging workflow not detected
Maintained⚠️ 23 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Token-Permissions🟢 10GitHub workflow tokens follow principle of least privilege
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Binary-Artifacts🟢 10no binaries found in the repo
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md
Security-Policy🟢 3security policy file detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0

Scanned Files

  • .github/workflows/e2e-python.yml

@github-actions github-actions Bot added the size/XL Extra large PR (500+ lines) label Jul 15, 2026
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
🤖 AI Agent: breaking-change-detector — API Compatibility

AI-generated review output. Treat it as untrusted analysis and verify before acting.

API Compatibility

No breaking changes detected.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
🤖 AI Agent: docs-sync-checker — Docs Sync

AI-generated review output. Treat it as untrusted analysis and verify before acting.

Docs Sync

  • tests/e2e_python/README.md -- newly added file, documentation is in sync.
  • .github/workflows/e2e-python.yml -- new workflow added, no documentation update required in README.md.
  • No new public APIs without docstrings detected.
  • CHANGELOG is missing an entry for the new Python governance scenarios and CI workflow.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
🤖 AI Agent: security-scanner — View details

AI-generated review output. Treat it as untrusted analysis and verify before acting.

No security issues found.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
🤖 AI Agent: test-generator — `tests/e2e_python/scenarios/policy_deny/test_policy_deny.py`

AI-generated review output. Treat it as untrusted analysis and verify before acting.

tests/e2e_python/scenarios/policy_deny/test_policy_deny.py

  • test_policy_deny_unauthorized_action -- Validate denial of unauthorized live budget mutation.
  • test_policy_deny_boundary_conditions -- Test edge cases for policy denial logic.

tests/e2e_python/scenarios/policy_allow/test_policy_allow.py

  • test_policy_allow_valid_action -- Ensure allowance of valid non-diagnostic record updates.
  • test_policy_allow_invalid_action -- Verify rejection of invalid actions under the policy.

tests/e2e_python/scenarios/pii_redaction/test_pii_redaction.py

  • test_pii_redaction_completeness -- Check that all sensitive data is redacted before model/tool boundaries.
  • test_pii_redaction_edge_cases -- Validate redaction for edge-case inputs (e.g., nested PII).

tests/e2e_python/scenarios/prompt_injection/test_prompt_injection.py

  • test_prompt_injection_detection -- Ensure poisoned content is detected and blocked.
  • test_prompt_injection_false_positive -- Verify no false positives for benign content.

tests/e2e_python/scenarios/filesystem_escape/test_filesystem_escape.py

  • test_filesystem_escape_prevention -- Confirm sandbox prevents unauthorized filesystem writes.
  • test_filesystem_escape_edge_cases -- Test sandbox behavior with edge-case paths or filenames.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
🤖 AI Agent: code-reviewer — View details

AI-generated review output. Treat it as untrusted analysis and verify before acting.

TL;DR: 0 blockers, 2 warnings. Comprehensive and secure implementation with minor follow-up considerations.

# Sev Issue Where
1 W Lack of explicit timeout for Ollama server .github/workflows/e2e-python.yml
2 W No validation for AGT_E2E_MODEL_ATTEMPTS .github/workflows/e2e-python.yml

Action items:

  1. Add an explicit timeout mechanism for the Ollama server startup to avoid indefinite hangs.
  2. Validate AGT_E2E_MODEL_ATTEMPTS to ensure it is a positive integer. Fine as follow-up PRs.

@prayagupa
prayagupa force-pushed the feat/python-governance-e2e branch from 0e12d1f to a05d7d4 Compare July 16, 2026 03:58
Comment thread tests/e2e_python/scenarios/prompt_injection/test_prompt_injection.py Outdated
Comment thread tests/e2e_python/README.md Outdated
Comment thread tests/e2e_python/README.md Outdated
Comment thread scripts/check_v4_ratchet.py Outdated
@prayagupa
prayagupa force-pushed the feat/python-governance-e2e branch from 00e0d69 to b8f8b07 Compare July 17, 2026 18:05

@MohammadHaroonAbuomar MohammadHaroonAbuomar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • .github/workflows/e2e-python.yml: the new uses: dtolnay/rust-toolchain@stable step is a mutable tag; this repo pins that exact action to dtolnay/rust-toolchain@29eef33 # stable in policy-engine-ci.yml (x2) and ci.yml:1074. SHA-pin it to match repo convention. Everything else in the ACS migration is verified sound (semantics preserved with default-deny strengthening; no fail-open at harness/SDK/Rust-core layers; ratchet exemption removal correct, ratchet passes locally; cache/upload-artifact bumps SHA-verified against upstream tags).

@prayagupa
prayagupa force-pushed the feat/python-governance-e2e branch from 0884dc6 to ecace4b Compare July 17, 2026 18:54
@prayagupa
prayagupa force-pushed the feat/python-governance-e2e branch from ecace4b to 88f7a6e Compare July 20, 2026 17:38
Signed-off-by: Prayag Upadhyay <prayag.upd@gmail.com>
Signed-off-by: Prayag Upadhyay <prayag.upd@gmail.com>
Use an explicit protocol stub and a distinct canary value for the blocked filesystem write.

Signed-off-by: Prayag Upadhyay <prayag.upd@gmail.com>
Signed-off-by: Prayag Upadhyay <prayag.upd@gmail.com>
Signed-off-by: Prayag Upadhyay <prayag.upd@gmail.com>
Signed-off-by: Prayag Upadhyay <prayag.upd@gmail.com>
@prayagupa
prayagupa force-pushed the feat/python-governance-e2e branch from 88f7a6e to c0fec3f Compare July 20, 2026 22:42
liamcrumm
liamcrumm previously approved these changes Jul 20, 2026
Signed-off-by: Prayag Upadhyay <prayag.upd@gmail.com>
@MohammadHaroonAbuomar
MohammadHaroonAbuomar merged commit 829065c into main Jul 21, 2026
135 checks passed
@MohammadHaroonAbuomar
MohammadHaroonAbuomar deleted the feat/python-governance-e2e branch July 21, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation scripts/ci/cd size/XL Extra large PR (500+ lines) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants